package edu.nf.api.controller.handler;

import edu.nf.vo.ResultVO;
import org.nf.web.annotation.ExceptionHandler;
import org.nf.web.servlet.View;
import org.nf.web.servlet.view.JsonView;

/***
 * 处理全局异常
 */
public class GlobalExceptionHandler {
    @ExceptionHandler(RuntimeException.class)
    public View handleLoginException(RuntimeException e) {
        e.printStackTrace();
        System.out.println("e = " + e.getMessage());
        ResultVO vo = new ResultVO();
        vo.setCode(500);
        vo.setMsg("服务器内部错误，请稍后尝试");
        return new JsonView(vo);
    }
}
